.class public Lrexsee/sensor/RexseeSensorTemperature;
.super Ljava/lang/Object;
.source "RexseeSensorTemperature.java"

# interfaces
.implements Lrexsee/core/browser/clazz/JavascriptInterface;


# static fields
.field public static final EVENT_ONTEMPERATURECHANGED:Ljava/lang/String; = "onTemperatureChanged"

.field private static final INTERFACE_NAME:Ljava/lang/String; = "Temperature"


# instance fields
.field private lastEvent:J

.field private lastUpdate:J

.field private mAccuracy:F

.field private final mBrowser:Lrexsee/core/browser/Browser;

.field private final mContext:Landroid/content/Context;

.field private mCycle:I

.field private mEventCycle:I

.field private mRate:I

.field private final mSensor:Landroid/hardware/Sensor;

.field private final mSensorListener:Landroid/hardware/SensorEventListener;

.field private final mSensorManager:Landroid/hardware/SensorManager;

.field private value:F


# direct methods
.method public constructor <init>(Lrexsee/core/browser/Browser;)V
    .locals 4
    .param p1, "browser"    # Lrexsee/core/browser/Browser;

    .prologue
    const-wide/16 v2, -0x1

    const/16 v1, 0x64

    .line 45
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 35
    const/4 v0, 0x3

    iput v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mRate:I

    .line 36
    iput v1, p0, Lrexsee/sensor/RexseeSensorTemperature;->mCycle:I

    .line 37
    iput v1, p0, Lrexsee/sensor/RexseeSensorTemperature;->mEventCycle:I

    .line 38
    const/4 v0, 0x0

    iput v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mAccuracy:F

    .line 40
    iput-wide v2, p0, Lrexsee/sensor/RexseeSensorTemperature;->lastUpdate:J

    .line 41
    iput-wide v2, p0, Lrexsee/sensor/RexseeSensorTemperature;->lastEvent:J

    .line 43
    const v0, -0x3b864000    # -999.0f

    iput v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->value:F

    .line 46
    invoke-virtual {p1}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mContext:Landroid/content/Context;

    .line 47
    iput-object p1, p0, Lrexsee/sensor/RexseeSensorTemperature;->mBrowser:Lrexsee/core/browser/Browser;

    .line 48
    iget-object v0, p1, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onTemperatureChanged"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 50
    iget-object v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mContext:Landroid/content/Context;

    const-string v1, "sensor"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/hardware/SensorManager;

    iput-object v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mSensorManager:Landroid/hardware/SensorManager;

    .line 52
    iget-object v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mSensorManager:Landroid/hardware/SensorManager;

    const/4 v1, 0x7

    invoke-virtual {v0, v1}, Landroid/hardware/SensorManager;->getDefaultSensor(I)Landroid/hardware/Sensor;

    move-result-object v0

    iput-object v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mSensor:Landroid/hardware/Sensor;

    .line 54
    new-instance v0, Lrexsee/sensor/RexseeSensorTemperature$1;

    invoke-direct {v0, p0}, Lrexsee/sensor/RexseeSensorTemperature$1;-><init>(Lrexsee/sensor/RexseeSensorTemperature;)V

    iput-object v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mSensorListener:Landroid/hardware/SensorEventListener;

    .line 76
    return-void
.end method

.method static synthetic access$0(Lrexsee/sensor/RexseeSensorTemperature;)J
    .locals 2

    .prologue
    .line 40
    iget-wide v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->lastUpdate:J

    return-wide v0
.end method

.method static synthetic access$1(Lrexsee/sensor/RexseeSensorTemperature;)I
    .locals 1

    .prologue
    .line 36
    iget v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mCycle:I

    return v0
.end method

.method static synthetic access$2(Lrexsee/sensor/RexseeSensorTemperature;J)V
    .locals 0

    .prologue
    .line 40
    iput-wide p1, p0, Lrexsee/sensor/RexseeSensorTemperature;->lastUpdate:J

    return-void
.end method

.method static synthetic access$3(Lrexsee/sensor/RexseeSensorTemperature;)F
    .locals 1

    .prologue
    .line 43
    iget v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->value:F

    return v0
.end method

.method static synthetic access$4(Lrexsee/sensor/RexseeSensorTemperature;F)V
    .locals 0

    .prologue
    .line 43
    iput p1, p0, Lrexsee/sensor/RexseeSensorTemperature;->value:F

    return-void
.end method

.method static synthetic access$5(Lrexsee/sensor/RexseeSensorTemperature;)J
    .locals 2

    .prologue
    .line 41
    iget-wide v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->lastEvent:J

    return-wide v0
.end method

.method static synthetic access$6(Lrexsee/sensor/RexseeSensorTemperature;)I
    .locals 1

    .prologue
    .line 37
    iget v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mEventCycle:I

    return v0
.end method

.method static synthetic access$7(Lrexsee/sensor/RexseeSensorTemperature;)F
    .locals 1

    .prologue
    .line 38
    iget v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mAccuracy:F

    return v0
.end method

.method static synthetic access$8(Lrexsee/sensor/RexseeSensorTemperature;J)V
    .locals 0

    .prologue
    .line 41
    iput-wide p1, p0, Lrexsee/sensor/RexseeSensorTemperature;->lastEvent:J

    return-void
.end method

.method static synthetic access$9(Lrexsee/sensor/RexseeSensorTemperature;)Lrexsee/core/browser/Browser;
    .locals 1

    .prologue
    .line 30
    iget-object v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mBrowser:Lrexsee/core/browser/Browser;

    return-object v0
.end method


# virtual methods
.method public getAccuracy()F
    .locals 1

    .prologue
    .line 104
    iget v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mAccuracy:F

    return v0
.end method

.method public getCycle()I
    .locals 1

    .prologue
    .line 92
    iget v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mCycle:I

    return v0
.end method

.method public getEventCycle()I
    .locals 1

    .prologue
    .line 98
    iget v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mEventCycle:I

    return v0
.end method

.method public getInheritInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 20
    return-object p0
.end method

.method public getInterfaceName()Ljava/lang/String;
    .locals 2

    .prologue
    .line 16
    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v1, p0, Lrexsee/sensor/RexseeSensorTemperature;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v1, v1, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget-object v1, v1, Lrexsee/core/application/RexseeApplication;->resources:Lrexsee/core/application/Resource;

    iget-object v1, v1, Lrexsee/core/application/Resource;->prefix:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "Temperature"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getLastKnownValue()Ljava/lang/String;
    .locals 2

    .prologue
    .line 79
    iget v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->value:F

    const v1, -0x3b864000    # -999.0f

    cmpl-float v0, v0, v1

    if-nez v0, :cond_0

    const-string v0, "null"

    :goto_0
    return-object v0

    :cond_0
    iget v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->value:F

    invoke-static {v0}, Ljava/lang/String;->valueOf(F)Ljava/lang/String;

    move-result-object v0

    goto :goto_0
.end method

.method public getNewInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 1
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 24
    new-instance v0, Lrexsee/sensor/RexseeSensorTemperature;

    invoke-direct {v0, p1}, Lrexsee/sensor/RexseeSensorTemperature;-><init>(Lrexsee/core/browser/Browser;)V

    return-object v0
.end method

.method public getRate()Ljava/lang/String;
    .locals 1

    .prologue
    .line 86
    iget v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mRate:I

    invoke-static {v0}, Lrexsee/sensor/SensorRate;->getString(I)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public isReady()Z
    .locals 1

    .prologue
    .line 108
    iget-object v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mSensor:Landroid/hardware/Sensor;

    if-nez v0, :cond_0

    const/4 v0, 0x0

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x1

    goto :goto_0
.end method

.method public setAccuracy(F)V
    .locals 1
    .param p1, "value"    # F

    .prologue
    .line 101
    invoke-static {p1}, Ljava/lang/Math;->abs(F)F

    move-result v0

    iput v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mAccuracy:F

    .line 102
    return-void
.end method

.method public setCycle(I)V
    .locals 0
    .param p1, "milliseconds"    # I

    .prologue
    .line 89
    iput p1, p0, Lrexsee/sensor/RexseeSensorTemperature;->mCycle:I

    .line 90
    return-void
.end method

.method public setEventCycle(I)V
    .locals 0
    .param p1, "milliseconds"    # I

    .prologue
    .line 95
    iput p1, p0, Lrexsee/sensor/RexseeSensorTemperature;->mEventCycle:I

    .line 96
    return-void
.end method

.method public setRate(Ljava/lang/String;)V
    .locals 1
    .param p1, "rate"    # Ljava/lang/String;

    .prologue
    .line 83
    invoke-static {p1}, Lrexsee/sensor/SensorRate;->getInt(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mRate:I

    .line 84
    return-void
.end method

.method public start()V
    .locals 4

    .prologue
    .line 111
    invoke-virtual {p0}, Lrexsee/sensor/RexseeSensorTemperature;->isReady()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 112
    iget-object v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mSensorManager:Landroid/hardware/SensorManager;

    iget-object v1, p0, Lrexsee/sensor/RexseeSensorTemperature;->mSensorListener:Landroid/hardware/SensorEventListener;

    iget-object v2, p0, Lrexsee/sensor/RexseeSensorTemperature;->mSensor:Landroid/hardware/Sensor;

    iget v3, p0, Lrexsee/sensor/RexseeSensorTemperature;->mRate:I

    invoke-virtual {v0, v1, v2, v3}, Landroid/hardware/SensorManager;->registerListener(Landroid/hardware/SensorEventListener;Landroid/hardware/Sensor;I)Z

    .line 116
    :goto_0
    return-void

    .line 114
    :cond_0
    iget-object v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/sensor/RexseeSensorTemperature;->getInterfaceName()Ljava/lang/String;

    move-result-object v1

    const-string v2, "Temperature sensor is not found."

    invoke-virtual {v0, v1, v2}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0
.end method

.method public stop()V
    .locals 2

    .prologue
    .line 118
    invoke-virtual {p0}, Lrexsee/sensor/RexseeSensorTemperature;->isReady()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 119
    iget-object v0, p0, Lrexsee/sensor/RexseeSensorTemperature;->mSensorManager:Landroid/hardware/SensorManager;

    iget-object v1, p0, Lrexsee/sensor/RexseeSensorTemperature;->mSensorListener:Landroid/hardware/SensorEventListener;

    invoke-virtual {v0, v1}, Landroid/hardware/SensorManager;->unregisterListener(Landroid/hardware/SensorEventListener;)V

    .line 121
    :cond_0
    return-void
.end method
